package cn.com.infcn.spider;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.com.infcn.spider.util.JythonRunner;

public class JythonTest2 {

	public static void main(String[] args) {
		Map<String, Object> map = new HashMap<>();
		PageBean page = new PageBean();
		map.put("page", page);
		
		JythonRunner.run(map, "page.setValue(\"jijs\",\"100\"); ");
		JythonRunner.run(map, "page.printInfo();");
		JythonRunner.run(map, "list=[\"aa\",\"bb\",\"cc\"];page.addList(list);");
		
	}

	public static class PageBean{
		private String name;
		private String page;
		
		public void setValue(String name, String page){
			this.name = name;
			this.page = page;
			System.out.println("name:"+name+";\tpage:"+page);
		}
		
		public void printInfo(){
			System.out.println("============");
			System.out.println("name:"+name);
			System.out.println("page"+page);
			System.out.println("============");
		}
		
		public void addList(List<String> list){
			
			if(list!=null){
				for (String s : list) {
					System.out.println(s);
				}
			}
		}
	}
}
